package com.ebt.m.commons.widgets;


import android.content.Intent;
import android.preference.PreferenceManager;

import com.ebt.m.commons.buscomponent.listview.BaseIView;
import com.trello.rxlifecycle2.LifecycleTransformer;
import com.trello.rxlifecycle2.android.ActivityEvent;
import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;

/**
 * Created by wanglu on 2017/12/26.
 */

public class BaseRxActivity extends RxAppCompatActivity implements BaseIView {
    @Override
    public <T> LifecycleTransformer<T> getLifeTransformer() {
        return bindUntilEvent(ActivityEvent.PAUSE);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (mActivityResultListener != null) {
            mActivityResultListener.onActivityResult(requestCode, resultCode,
                    data);
        }
    }

    private PreferenceManager.OnActivityResultListener mActivityResultListener;

    public void setOnActivityResultListener(PreferenceManager.OnActivityResultListener l) {
        this.mActivityResultListener = l;
    }
}
